<%@ include file="/en/jsp/static.jsp" %>
<%@ taglib uri="/linuxbox/Todo.tld" prefix="todo" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

<%
  String SUBJECT = (String) request.getAttribute("SUBJECT");
  String DESCRIPTION = (String) request.getAttribute("DESCRIPTION");
  String ASSIGNEDBY = (String) request.getAttribute("ASSIGNEDBY");
  String CATEGORY = (String)request.getAttribute("CATEGORY");
  int DUE_YEAR = Integer.parseInt((String)request.getAttribute("DUE_YEAR"));
  int DUE_MONTH = Integer.parseInt((String)request.getAttribute("DUE_MONTH"));
  int DUE_DAY = Integer.parseInt((String)request.getAttribute("DUE_DAY"));

  int START_YEAR = Integer.parseInt((String)request.getAttribute("START_YEAR"));
  int START_MONTH = Integer.parseInt((String)request.getAttribute("START_MONTH"));
  int START_DAY = Integer.parseInt((String)request.getAttribute("START_DAY"));

  int PRIORITY = Integer.parseInt((String)request.getAttribute("PRIORITY"));
  int COMPLETE = Integer.parseInt((String)request.getAttribute("COMPLETE"));
  int ID = Integer.parseInt((String)request.getAttribute("ID"));
%>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>


<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
<tr><td>
    &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
    <b><%=boxName%> - Todo Edit</b>
</td></tr>
</table>

<hr width=\"100%\" color=#E06000 align=left>

<table width="100%" border=0 cellpadding=0 cellspacing=0>
<tr><td>

  <table width= "100%" border=1 cellspacing=0 cellpadding=1>
    <tr><td>
      <table border=0 width="100%" bgcolor=#e0e0e0 style="font-size:14px">
        <form action="<%=BoxStatic.servletDir%>BoxTodoAction" method=post>
          <input type=hidden name=ID value=<%=ID%>>
          <tr><td>
            <b>Due Date:</b>
            <select name="DUE_MONTH" size="1">
              <common:MonthList selected="<%=DUE_MONTH%>" allownull="false" />
            </select>
            <select name="DUE_DAY" size="1">
              <common:DayList selected="<%=DUE_DAY%>" allownull="false" />
            </select>
            <select name="DUE_YEAR" size="1">
              <common:YearList selected="<%=DUE_YEAR%>" allownull="false" />
            </select>

            <b>Start Date:</b>
            <select name="START_MONTH" size="1">
                <common:MonthList allownull="true" selected="<%=START_MONTH%>"/>
            </select>
            <select name="START_DAY" size="1">
              <common:DayList selected="<%=START_DAY%>" allownull="true" />
            </select>
            <select name="START_YEAR" size="1">
              <common:YearList selected="<%=START_YEAR%>" allownull="true" />
            </select>
          </td></tr>
          <tr><td>
            <b>Subject:</b> <input align=right type=text name=SUBJECT size=50 value="<%=SUBJECT%>">
          </td></tr>
          <tr><td>
            <b>Category:</b>
            <select name="CATEGORY" size="1">
              <todo:TodoCatList selected="<%=CATEGORY%>" showsystemcat="true" userid="<%=curUserID%>"/>
            </select>
          </td></tr>
          <tr><td>
            <b>Description:</b><br>
            <textarea name=DESCRIPTION rows=5 cols=60><%=DESCRIPTION%></textarea><br>
          </td></tr>
          <tr><td>
            <b><input type=checkbox name=COMPLETE
            <%
              if ( COMPLETE != 0)
                out.print(" checked ");
            %>>Completed</b>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <b>Priority:</b>
            <SELECT name="PRIORITY" size="1">
              <option value=0 <% if (PRIORITY==0) out.print("selected"); %>>Low</option>
              <option value=1 <% if (PRIORITY==1) out.print("selected"); %>>Normal</option>
              <option value=2 <% if (PRIORITY==2) out.print("selected"); %>>High</option>
            </SELECT>
            <%
              if (ASSIGNEDBY!=null && ASSIGNEDBY.length() >0)
              {
                out.print(" <b>Assigned By:</b>");
                out.print(ASSIGNEDBY);
              }
            %>
          </td></tr>
          <tr><td>
            <input type=submit value=
<%
      if (ID==0)
        out.println("\"Add\" name=SubmitSave");
      else
      {
        out.println("\"Update\" name=SubmitUpdate>");
        out.println("<input type=submit value=\"Delete\" name=SubmitDelete");
      }
%>
            >
            <input type=button value="Cancel" onclick="window.history.go(-1)" >
          </td></tr>
        </form>
      </table>
    </td></tr>
  </table>

</td></tr>
</table>

<hr width=\"100%\" color=#E06000 align=left>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
